﻿<%@ Page Title="" Language="C#" MasterPageFile="~/uc/MemberIndex.Master" validateRequest="false" AutoEventWireup="true" CodeBehind="shop_about.aspx.cs" Inherits="ncp.Web.member.shop_about" %>
<asp:Content ID="Content1" ContentPlaceHolderID="header" runat="server">
    <title>关于我们-中国农业信息化服务商</title>

    <script src="../Plugin/ueditor/editor_config.js" type="text/javascript"></script>

    <script src="../Plugin/ueditor/editor_all.js" type="text/javascript"></script>

    <link href="../Plugin/ueditor/themes/default/ueditor.css" rel="stylesheet" type="text/css" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="bh-con-right-h-yy"><a href="#">店铺管理</a> > 关于我们</div>
    <div class="mod-content">
        <div id="aboutUs"></div>
    </div>
    <div style="height: 40px;text-align: center">
        <input type="button" value="修 改" id="modify" class="bh-lr-btn"/>
         <input type="button" value="取 消" id="cancle" onclick="onCancle()" class="bh-lr-btn" style="display: none"/>
    </div>
    <script type="text/javascript">
    	//获取关于我们
    	function getAboutUs() {
    		var response = ncp.Web.member.shop_about.GetAbout();
    		if (response.value != null) {
                var jsonOBJ = eval(response.value)[0];
    			if (jsonOBJ.isreload) {
    			    return jsonOBJ.msg == null ? "" : jsonOBJ.msg;
    			}
    			return "";
            }
    	}

    	$(function() {
    		$("#aboutUs").html(getAboutUs());
    		$("#modify").bind("click", loadEdtor);
    	});
    	var editor = new baidu.editor.ui.Editor();
    	//加载编辑器
    	function loadEdtor() {
        	editor = new baidu.editor.ui.Editor({
        	toolbars: nomalToolbar
        		//,autoHeightEnabled:false
        		,minFrameHeight:400
        	});
        	$("#aboutUs").html("");
        	editor.render("aboutUs");
        	editor.setContent(getAboutUs());
        	$("#modify").unbind("click", loadEdtor);
        	$("#modify").bind("click", modifyAbout);
            
        	$("#cancle").show();
        }
        //修改数据

        function modifyAbout() {
        	var content = editor.getContent();
        	//保存内容
        	var response = ncp.Web.member.shop_about.SaveAboutUs(content);
        	if (response.value != null) {
        		var jsonOBJ = eval(response.value)[0];
        		alert(jsonOBJ.msg);
        		if (jsonOBJ.isreload) {
        			onCancle();
        		}
        	}
        }

        function onCancle() {
        	editor.destroy();
        	$("#aboutUs").html(getAboutUs());
        	$("#modify").unbind("click", modifyAbout);
        	$("#modify").bind("click", loadEdtor);
        	$("#cancle").hide();
        }
    </script>
</asp:Content>
